# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-django-extensions
_pyname=django-extensions
pkgver=3.2.3
pkgrel=3
arch="noarch"
pkgdesc="A collection of custom extensions for the Django Framework"
url="https://pypi.python.org/project/django-extensions"
license="MIT"
depends="
	python3
	py3-django
	py3-aiosmtpd
	"
makedepends="
	py3-setuptools
	py3-wheel
	py3-gpep517
	"
checkdepends="
	py3-pytest
	py3-pygments
	py3-shortuuid
	py3-pytest-cov
	py3-pytest-django
	py3-pytest-factoryboy
	py3-django-rest-framework
	py3-pip
	py3-requests
	py3-werkzeug
	"
source="
	$pkgname-$pkgver-gh.tar.gz::https://github.com/django-extensions/django-extensions/archive/refs/tags/$pkgver.tar.gz
	1841_update-mail-debug-command-to-use-aiosmtpd.patch
	"
builddir="$srcdir"/$_pyname-$pkgver
subpackages="$pkgname-pyc"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	# test_pipchecker: seems to expect control over system libraries
	# DumpScriptTests: django.db.utils.OperationalError: no such table: django_extensions_permmodel
	# test_installed_apps_no_resolve_conflicts_function:  AssertionError: "Can't instantiate abstract class CRNoFunction with abstract method resolve_collisions" does not match "Can't instantiate abstract class CRNoFunction without an implementation for abstract method 'resolve_collisions'"
	# test_do_export_emails_format_vcard_start: SystemExit 1
	.testenv/bin/python3 -m pytest -v -k 'not test_pipchecker and not DumpScriptTests and not test_installed_apps_no_resolve_conflicts_function and not test_do_export_emails_format_vcard_start'
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
0d4d34678d829c91e9af917b63a35c327cea83591c021834e97c784293d7e94b98e5fff5676e52fed6cfb4c2add2ac98301c742354555a345d55896c0b83f0d2  py3-django-extensions-3.2.3-gh.tar.gz
7f22a6c0657a86935a52cdcff38234eb65f6c50502b1a79b4746e2ddc18bf8414a4f220b61c84c7106673bb595c50d462c08289da6fffc4a86b15653abd2b248  1841_update-mail-debug-command-to-use-aiosmtpd.patch
"
